import { defineNuxtConfig } from 'nuxt3'

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
  meta: {
    title: 'Nuxt3 Template',
    meta: [
      { charset: 'utf-8' },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1, user-scalable=0',
      },
      {
        hid: 'keywords',
        name: 'keywords',
        content: 'keywords',
      },
      {
        hid: 'description',
        name: 'description',
        content: 'description',
      },
    ],
    link: [],
    script: [],
  },
  css: ['assets/scss/index.scss'],
  // NUXT_PORT
  server: {
    port: 9000
  },
  build: {
    postcss: {
      postcssOptions: {
        plugins: {
          autoprefixer: {}
        }
      }
    }
  },
  vite: {
    css: {
      // https://github.com/nuxt-community/style-resources-module/issues/190
      // https://vite.nuxtjs.org/misc/common-issues/#styleresources
      preprocessorOptions: {
        scss: {
          additionalData: '@import "@/assets/scss/global.scss";',
        },
      },
    },
  },
  buildModules: [
    "@pinia/nuxt"
  ],
  router: {
    extendRoutes(routes: any) {
      routes.push({
        path: '*',
        redirect: '/404',
      })
    },
  }
})
